import java.util.Stack;

public class LC_232 {
}
class MyQueue {

    Stack<Integer> stackIn;
    Stack<Integer> stackOut;
    int size;
    public MyQueue() {
        stackIn = new Stack<>();
        stackOut = new Stack<>();
        size = 0;
    }

    public void push(int x) {
        stackIn.push(x);
        size++;
    }

    public int pop() {
        if(stackOut.empty()){
            while(stackIn.size() != 0){
                stackOut.push(stackIn.pop());
            }
        }

        size--;
        return stackOut.pop();
    }

    public int peek() {
        if(stackOut.empty()){
            while(stackIn.size() != 0){
                stackOut.push(stackIn.pop());
            }
        }
        return stackOut.peek();
    }

    public boolean empty() {
        return size == 0 ? true : false;
    }
}
